using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Configuration;
using System.Web.Security;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
using NENAData.Events;

public partial class LoadOptions : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (! IsPostBack)
            LoadEvents();  
    }

    private void LoadEvents()
    {
        var item = new RadListBoxItem();
        
        //item.("Item Text");
        radListBoxMembership.Items.Add(new RadListBoxItem("NENA Member", "true"));
        radListBoxMembership.Items.Add(new RadListBoxItem("NENA Non-Member", "false"));
        radListBoxMembership.DataBind();
    }
        
    protected void SelectMembership(object sender, EventArgs e)
    {
        var o = new NENAData.Events.List();
        //RadGrid1.MasterTableView = o.GetAll(true, NENAData.Transactions.TransactionList.Transactions.ConferenceRegina2011);
        //RadGrid1.DataSource = o.GetAll(true, NENAData.Transactions.TransactionList.Transactions.ConferenceRegina2011);
        var oSelection = Convert.ToBoolean(radListBoxMembership.SelectedItem.Value.ToString());

        GridView1.DataSource = o.GetAll(oSelection, NENAData.Transactions.TransactionList.Transactions.ConferenceRegina2012);
        GridView1.DataBind();
        //RadGrid1.DataSource 
        //RadGrid1.DataBind();   
        var oSlots = new NENAData.Events.Slots();

        GridViewSessionGroup.DataSource = oSlots.GetSlotsByEvent(6);
        GridViewSessionGroup.DataBind();
    }

    protected void EventsDataGrid_SelectedIndexChange(object sender, EventArgs e)
    {
        //Response.Write(GridView1.SelectedValue.ToString());
        GridViewRow row = GridView1.SelectedRow;
        //response write does not work in ajax controls
        //Response.Write("selected value = " + row.Cells[1].Text);
        var oSlotSession = new NENAData.Events.SlotSession();
        int intEvent =  Convert.ToInt32(row.Cells[1].Text);
        GridViewSlotSessions.DataSource = oSlotSession.GetSessionsByEvent(intEvent);
        GridViewSlotSessions.DataBind();

    }

    protected void SelectSessionSlots(object sender, EventArgs e)
    {
        var o = new NENAData.Events.Slots();
        //GridView1.SelectedRow.DataItem[]
        //GridViewSlotSessions.DataSource = o.GetAll(GridView1.SelectedIndex
    }


}
